package com.logicwin.RobotTravel;

import com.logicwin.RobotTravel.Position.Position;
import com.logicwin.RobotTravel.Services.Impl.ServiceManager;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.widget.Button;
import android.widget.TextView;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
public class CueDialog extends Dialog{
	
	private CueDialogInterface mAccept;
	private CueDialogInterface mReject;
	private String mText;
	public CueDialog(Context context,String text,
			CueDialogInterface accept, CueDialogInterface reject){
		super(context);
		mText = text;
		mAccept = accept;
		mReject = reject;
	}
/*	protected void onCreate(Bundle saveInstanceState){
		super.onCreate(saveInstanceState);
		setContentView(R.layout.cue_dialog);   
		TextView txtView = (TextView)findViewById(R.id.cue_dialog_text); 
		txtView.setText(mText);
		Button buttonYes = (Button) findViewById(R.id.Cue_Dialog_Accept);   
		buttonYes.setOnClickListener(new Button.OnClickListener(){   
			public void onClick(View v) {
				mAccept.OnClick();
				dismiss();
			}
		});
		Button buttonNo = (Button) findViewById(R.id.Cue_Dialog_Decline); 
		buttonNo.setOnClickListener(new Button.OnClickListener(){   
			public void onClick(View v) {
				mReject.OnClick();
				dismiss();
			}
		});
	}*/
	
    public void setDisplay(){
		setContentView(R.layout.cue_dialog);   
		//TextView txtView = (TextView)findViewById(R.id.cue_dialog_text); 
		//txtView.setText(mText);
		Button buttonYes = (Button) findViewById(R.id.Cue_Dialog_Accept);   
		buttonYes.setOnClickListener(new Button.OnClickListener(){   
			public void onClick(View v) {
				mAccept.OnClick();
				dismiss();
			}
		});
		Button buttonNo = (Button) findViewById(R.id.Cue_Dialog_Decline); 
		buttonNo.setOnClickListener(new Button.OnClickListener(){   
			public void onClick(View v) {
				mReject.OnClick();
				dismiss();
			}
		});
    	setProperty();
/*    	Position position = ServiceManager.getPositoinService().getCurPosition();*/
        setTitle("您的位置在"+mText+"，是否需要语音导航");
        show();
    }	
    public void setProperty(){
    	Window window = getWindow();
        WindowManager.LayoutParams wl = window.getAttributes();
/*        wl.x =0;
        wl.y =180;*/
        //wl.width = 240;
        //wl.height = 160;
        //wl.alpha=0.6f;
        wl.gravity=Gravity.CENTER;         
        window.setAttributes(wl); 
   }	
/*	protected void onStop() {   
		Log.d("TAG","+++++++++++++++++++++++++++");   
	} */ 	
}
